package happy.study.clique.module.study.design.factory.normal;

import happy.study.clique.module.study.design.factory.normal.code.FactoryInterface;
import happy.study.clique.module.study.design.factory.normal.code.impl.OneFactory;
import happy.study.clique.module.study.design.factory.normal.code.impl.TwoFactory;

/**
 * 工厂模式，
 * 优点：符合开闭原则，增加产品时不需要修改原有代码。
 * 缺点：每个工厂只能创建一种产品
 *
 * @author fsq
 * @date 2021/11/12 15:43
 **/
public class RunMain {

    public static void main(String[] args) {

        FactoryInterface factory1 = new OneFactory();
        factory1.createProduct().doSomething();

        FactoryInterface factory2 = new TwoFactory();
        factory2.createProduct().doSomething();
    }
}
